fix(test): stabilize lifecycle, sleep, queue, and run edge cases#4660
fix(test): stabilize lifecycle, sleep, queue, and run edge cases#4660NathanFlurry wants to merge 1 commit intobreak-up/reenable-gateway-url-coveragefrom
Conversation
PR Review: fix(test): stabilize lifecycle, sleep, queue, and run edge casesOverviewThis PR stabilizes a broad set of flaky driver tests by:
The approach is sound overall. These changes reflect real non-determinism in the system rather than test implementation bugs. IssuesisDynamicSandboxRuntime() is fragile and undocumented (inline-client.ts) The process.cwd() === "/root" check is a platform-detection heuristic that will silently break if the sandbox working directory changes. The behavior divergence is significant: the sandbox path skips WebSocket entirely and uses direct action calls. This needs a comment explaining the constraint, and ideally should use an explicit environment variable or driver config flag instead. destroyActor silently swallows all errors (actor-lifecycle.ts) The final bare return at the end of the catch block swallows ALL unexpected errors from destroy(). The service_unavailable and destroy-race branches are intentional, but the catch-all fallthrough should throw err rather than silently returning, or have a comment explaining why every possible error is acceptable here. Duplicate event listener in broadcast test (actor-sleep-db.ts) Both connection.once("sleeping", ...) and connection.on("sleeping", ...) are registered for the same event. The on handler is redundant since the once handler already sets sleepingEventReceived = true, and the on listener leaks (never unsubscribed). Only once is needed. instanceof errors.ActorAborted replaced with duck-typing without explanation (queue.ts, actor/instance/queue.ts) Changing to error.group/code comparison is likely the right fix for cross-VM-context errors where instanceof fails, but there is no comment explaining why. This is non-obvious and will confuse future maintainers. Minor Notes
Positive Changes
Generated with Claude Code |
ecf268c to
4c4e267
Compare
dcb82e8 to
1d9c571
Compare
4c4e267 to
e823f78
Compare
1d9c571 to
8e50d57
Compare
8e50d57 to
f2052c1
Compare
e823f78 to
83bf5c0
Compare
f2052c1 to
5aeb5f4
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: